<?php
/** JavaScript-type object class, or Perl-type %hash
*   Allows both object-type and array-type access: $a->var and $a['var']
*   Index may be of number or string type (value of Yz_Int, Yz_String)
*
*   The array value of Yz_Hash can be fetched with:
*   - getValue()
*   - toArray()
*   The keys:
*   - keys()
*   - getKeys()
*   The values (with numeric indices):
*   - values()
*   - getValues()
*/

class Yz_Hash
    extends Yz_Array_Abstract
    implements Iterator,ArrayAccess,Countable,Yz_Array_Interface
{

    /**
    *   @var array value
    **/
    protected $value = array();


    /******************************
    ***     Public methods      ***
    *******************************/


    /** getKeys() : return the keys
    *   @return array<index:key>
    */
    public function getKeys()
    {
        return array_keys( $this->value );
    } // getKeys

    /** keys()
    *   alias for getKeys
    * @return array
    */
    public function keys()
    {
        return array_keys($this->value);
    } // keys

    /** getValues() : return the list of values w/o keys
     *  Note: this is different from the getValue() method
    *   @return array<index:value>
    */
    public function getValues()
    {
        return array_values($this->value);
    } // getValues

    /** values() : alias for getValues
    *   @return array<index:value>
    */
    public function values()
    {
        return array_values($this->value);
    } // values


    /** get a hash containing some of the elements of the original hash
     *
     *  @param int $from
     *  @param int|null $count
     *  @return Yz_Hash
     *  @todo check param types
     */
    public function slice( $from, $count=null )
    {
        debug();
        return $this->_slice($from, $count, true);
    } // slice



} // class

